<?php

namespace App\Utils\Helper;

class BaseHelper {
    protected static $instance;
    protected $entity_manager;
    protected $container;

    public function __construct () {
        $this->entity_manager = GetterHelper::getEntityManager();
        $this->container = GetterHelper::getContainer();
    }

    public function __clone () {
        trigger_error('Clone is not allow!', E_USER_ERROR);
    }

    /**
     * 获取单例
     * @param mixed ...$args
     * @return static
     */
    public static function getInstance (...$args) {
        if (!(static::$instance instanceof static)) {
            static::$instance = new static(...$args);
        }
        return static::$instance;
    }
}